#coding=utf-8
from selenium import webdriver
import unittest
import time

class TestSogou(unittest.TestCase):
    def setUp(self):
        self.browser=webdriver.Chrome()
        self.browser.implicitly_wait(30)
        self.base_url="https://www.sogou.com"
        self.verficationErrors=[]
        self.accept_next_alert=True

    def test_search(self):
        browser=self.browser
        browser.get(self.base_url+'/')
        browser.maximize_window()
        keyworld=browser.find_element_by_name("query")
        keyworld.send_keys("Selenium Python")
        browser.find_element_by_id("stb").click()
        browser.close()

    def test_weixin(self):
        browser=self.browser
        browser.get(self.base_url+'/')
        browser.maximize_window()
        browser.find_element_by_link_text("微信").click()
        browser.close()

    def tearDown(self):
        self.browser.quit()
        self.assertEqual([],self.verficationErrors)

if __name__=="__main__":
    unittest.main()